package creator

import (
	"os"
	"path/filepath"
)

type YamlFile struct {
	Pkg          string
	Template     string
	SkipIfExists bool
	Data         map[string]interface{}
	FileName     string
}

func (y *YamlFile) Create() error {
	wd, err := os.Getwd()
	if err != nil {
		return err
	}
	var file = &File{
		Wd:           filepath.Join(wd, y.Pkg),
		Template:     y.Template,
		Ext:          "yaml",
		SkipIfExists: y.SkipIfExists,
		Data:         y.Data,
		FileName:     y.FileName,
	}
	return file.Create()
}
